The alternative to using withContext() directly in the flow() lambda expression is to call flowOn() on the Flow, providing the dispatcher that you want used for the lambda expression.

You can learn more about this in:
Tags:
Run Edit